from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep

op = webdriver.ChromeOptions()
op.add_experimental_option('excludeSwitches', ['enable-automation'])
op.add_experimental_option('useAutomationExtension', False)
op.add_argument('--start-maximized')#窗口最大化
#op.add_argument("-headless")
driver = webdriver.Chrome(options=op)
driver.get('https://www.baidu.com')
sleep(2)

#driver.find_element_by_id('kw').send_keys('自动化测试')
#driver.find_element_by_id('su').click()
driver.find_element(By.ID, 'kw').send_keys('自动化测试')
driver.find_element(By.ID, 'su').click()
sleep(5)

assert '自动化测试' in driver.page_source
driver.quit()
